package com.ruoyi.system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.system.domain.zbg.IndicatorData;
import com.ruoyi.system.mapper.IndicatorDataMapper;
import com.ruoyi.system.service.IndicatorDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class IndicatorDataServiceImpl extends ServiceImpl<IndicatorDataMapper, IndicatorData> implements IndicatorDataService {

    @Autowired
    private IndicatorDataMapper indicatorDataMapper;

    @Transactional(rollbackFor = Exception.class)
    public void saveAll(List<IndicatorData> indicatorDataList) {
        for (IndicatorData indicatorData : indicatorDataList) {
            // 使用站点编码、年、月作为业务主键
            indicatorDataMapper.saveOrUpdate(indicatorData);
        }
    }
}